#include "Utils.h"
#include "ListNode.h"
#include "TreeNode.h"
#include <iostream>
#include <vector>
#include <string>

using namespace std;

class Queue {
private:
	vector<int> data;

public:
	// Push element x to the back of queue.
	void push(int x) {
		vector<int> temp;
		//store values to a temp stack
		while (data.size()>0)
		{
			int val=data.back();
			temp.push_back(val);
			data.pop_back();
		}
		//push back to the stack bottom
		data.push_back(x);
		//restore values from emp stack
		while (temp.size()>0)
		{
			int val=temp.back();
			data.push_back(val);
			temp.pop_back();
		}
	}

	// Removes the element from in front of queue.
	void pop(void) {
		data.pop_back();
	}

	// Get the front element.
	int peek(void) {
		return data.back();
	}

	// Return whether the queue is empty.
	bool empty(void) {
		return data.size()==0;
	}
};

int main232(){

	Queue queue;
	queue.push(1);
	queue.push(2);
	queue.push(3);
	
	int val=queue.peek();
	cout<<val<<endl;
	
	queue.pop();
	val=queue.peek();
	cout<<val<<endl;

	return 0;
}